 select GHRIF.ID,GHRIF.Service_ID,GHRIF.GHR_code,GHRIF.GHR_Userid,GHRIF.UserID,GHRIF.CheckDate,GHRIF.CheckTime,GHRIF.SN,GHRIF.CheckInOut_ID,GHRIF.Punch_Type,GHRIF.Process_YN,GHRIF.IF_Date,GHRIF.Status,GHRIF.IFFLG,userinfo.name from GHRIF
				left join userinfo on GHRIF.UserID=userinfo.badgenumber
				where userinfo.name is not null
				and CheckDate >= convert(varchar(10),getdate() -30,120)